<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>超市零售系统</title>
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" th:href="@{/vendor/bootstrap/css/bootstrap.min.css}">
    <link th:href="@{/vendor/fonts/circular-std/style.css}" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/libs/css/style.css}">
    <link rel="stylesheet" th:href="@{/vendor/fonts/fontawesome/css/fontawesome-all.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/vendor/datatables/css/dataTables.bootstrap4.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/vendor/datatables/css/buttons.bootstrap4.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/vendor/datatables/css/select.bootstrap4.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/vendor/datatables/css/fixedHeader.bootstrap4.css}">
</head>

<body>

<!-- main wrapper -->
<div class="dashboard-main-wrapper">
    <!-- navbar -->
    <div class="dashboard-header">
        <div th:insert="~{commons/commons::topBar}"></div>
    </div>

    <!-- left sidebar -->
    <div class="nav-left-sidebar sidebar-dark">
        <div class="menu-list">
            <div th:insert="~{commons/commons::sideBar}"></div>
        </div>
    </div>

    <!-- wrapper  -->

    <div class="dashboard-wrapper">
        <div class="container-fluid  dashboard-content">
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="page-header">
                        <h2 class="pageheader-title">用户信息</h2>
                        <div class="page-breadcrumb">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                </ol>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-4 column">
                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalFade">新增</button>
                </div>
            </div>
            <br>

            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered first text-center">
                                    <thead>
                                    <tr>
                                        <th>用户编号</th>
                                        <th>用户名</th>
                                        <th>用户类型</th>
                                        <th>用户密码</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="users : ${allUsers}">
                                        <td th:text="${users.getUser_id()}"></td>
                                        <td th:text="${users.getUser_name()}"></td>
                                        <td th:if="${users.getUser_type()}==0">收银员</td>
                                        <td th:if="${users.getUser_type()}==1">管理员</td>
                                        <td th:if="${users.getUser_type()}==2">超级管理员</td>
                                        <!--                                        <td th:text="${users.getUser_type()}"></td>-->
                                        <td th:text="${users.getUser_pwd()}"></td>
                                        <td>
                                            <a class="btn btn-sm btn-primary"
                                               th:href="@{/user/toUpdateUser/}+${users.getUser_id()}">修改</a>
                                            <a class="btn btn-sm btn-danger"
                                               th:href="@{/user/deleteUser/}+${users.getUser_id()}">删除</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

            </div>
        </div>
    </div>

    <div class="modal fade" id="modalFade" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel">用户信息</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <form id="validationform03" th:action="@{/user/insertUser}">
                            <div class="form-group row">
                                <label class="col-12 col-sm-3 col-form-label text-sm-right">用户编号</label>
                                <div class="col-12 col-sm-8 col-lg-6">
                                    <input type="text" name="user_id" placeholder="(请输入1-9个字符)" required
                                           class="form-control" maxlength="9">
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-12 col-sm-3 col-form-label text-sm-right">用户名称</label>
                                <div class="col-12 col-sm-8 col-lg-6">
                                    <input type="text" name="user_name" placeholder="(请输入1-12个字符)" required
                                           class="form-control" maxlength="12">
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-12 col-sm-3 col-form-label text-sm-right">用户类型</label>
                                <div class="col-12 col-sm-8 col-lg-6">
                                    <input type="radio" name="user_type" value="0">收银员 &nbsp;
                                    <input type="radio" name="user_type" value="1">管理员
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-12 col-sm-3 col-form-label text-sm-right">用户密码</label>
                                <div class="col-12 col-sm-8 col-lg-6">
                                    <input type="text" name="user_pwd" placeholder="(请输入1-12个字符)" required
                                           class="form-control" maxlength="12">
                                </div>
                            </div>
                            <div class="modal-footer" style="margin-right: 25%">
                                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                                <button type="submit" class="btn btn-space btn-primary" style="margin-top: 5px">提交</button>
                                <button type="reset" class="btn btn-space btn-secondary" style="margin-top: 5px">重置</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div></div>
    <!-- end footer -->
    <div class="footer">
        <div class="container-fluid">
            <div th:insert="~{commons/commons::footer}"></div>
        </div>
    </div>
</div>




<script th:src="@{/vendor/jquery/jquery-3.3.1.min.js}"></script>
<script th:src="@{/vendor/bootstrap/js/bootstrap.bundle.js}"></script>
<script th:src="@{/vendor/slimscroll/jquery.slimscroll.js}"></script>
<script th:src="@{/vendor/multi-select/js/jquery.multi-select.js}"></script>
<script th:src="@{/libs/js/main-js.js}"></script>

<script th:src="@{/vendor/datatables/js/dataTables.bootstrap4.min.js}"></script>
<script th:src="@{/vendor/datatables/js/buttons.bootstrap4.min.js}"></script>
<script th:src="@{/vendor/datatables/js/data-table.js}"></script>


</body>

</html>
